<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>TAS Instruction</title>
<link href="../edit68k.css" rel="stylesheet" type="text/css">
</head>

<body>
<h1 class="heading">TAS Instruction<BR>
<hr noshade></h1>
<BR>
<span class="text">The instruction TAS (Test And Set) examines a specified byte with an effective address. The most significant bit in the byte is set. The N- and Z-flags are set according to the bytes value before the operation. The instruction reads, modifies and sets and can't be interrupted. The instruction is used to synchronize if two or more MPU use the same memory area. Since TAS can't be interrupted a MPU can mark a location in the memory to be "busy" before another processor can examine it. If the operation was interruptible, two processor could examine the same byte at the same time, and both processor would think the byte was<BR>
free to use, which would lead to an error. TAS guaranties that one processor wins and the other loses. TAS is used by high level languages to implement "Semaphores"<BR>
<BR>
ADDRESS METHODS: Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l<BR>
<BR>
You can use TAS with a data register, but then it has nothing to do with synchronization.<BR>
<BR>
DATA LENGTH: Byte</span>
<br>
<br>          
<TABLE border=0 cellPadding=0 cellSpacing=0 width="56%">
  <TBODY>
    <TR>
      <TD width="27%" rowSpan=5 vAlign=top class="text">FLAGS:</TD>
      <TD width="73%" class="text">X - U</TD>
    </TR>
    <TR>
      <TD width="73%" class="text">N - S (before the operation)</TD>
    </TR>
    <TR>
      <TD width="73%" class="text">Z - S (before the operation)</TD>
    </TR>
    <TR>
      <TD width="73%" class="text">C - 0</TD>
    </TR>
    <TR>
      <TD width="73%" class="text">V - 0</TD>
    </TR>
  </TBODY>
</TABLE>
<P><span class="text">SYNTAX: TAS &lt;ea&gt;<BR>
</span></P>
<span class="text">
</span>
</body>
</html>
